﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Diagnostics;

namespace Samurai.Client
{
    public class ReportExceptionCommand : ICommand
    {
        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            var exception = (Exception)parameter;

            SendSupportEmail("salehein@gmail.com", "Client Issue:", string.Format("Exception: {0}\n Stack Trace: {1}", exception.Message, exception.StackTrace));
        }

        public void SendSupportEmail(string emailAddress, string subject, string body)
        {
            Process.Start("mailto:" + emailAddress + "?subject=" + subject + "&body=" + body);
        }
    }
}
